package com.example.a17376052_wcp_finaltest;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

import entire.Account;

public class ResigerActivity extends AppCompatActivity {
    private Button mBtnButton2;
    private EditText et_account, et_password, et_commit;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_resiger);
        et_account = findViewById(R.id.et_account);
        et_password = findViewById(R.id.et_password);
        et_commit = findViewById(R.id.et_commit);
        mBtnButton2 = findViewById(R.id.btn_button1);
        mBtnButton2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                String account = et_account.getText().toString().trim();
                String password = et_password.getText().toString().trim();
                Account account1 = new Account(account, password);
                account1.save();

                Toast.makeText(ResigerActivity.this, "注冊成功", Toast.LENGTH_SHORT).show();

                Intent intent = new Intent(ResigerActivity.this, MainActivity.class);
                startActivity(intent);
            }
        });

    }



    }


